<?php

class Surveys extends HTech_Db_Table
{
    protected $_name    = 'surveys';
    protected $_primary = 'SurveyId';  
    
    protected $_dependentTables = array('LnkSurveysQuestions');  
    
    protected function _setGridMetadata()
    {
        $this->_gridMetadata['title'] = $this->translate("Surveys");
        $this->_gridMetadata['onClick'] = 'survey.survey.view';
        $this->_gridMetadata['headers'] = array
            (
                array('SurveyId',     40, $this->translate("Id"),          'Number'),
                array('Status',       70, $this->translate("Status"),      'String'),
                array('Name',        270, $this->translate("Survey"),      'String'),
                array('Description', 470, $this->translate("Description"), 'String')
            );
        return $this;
    }
    
    protected function _setRecordDependentRows()
    {
        $this->_record->r = (object) array('question' => null);
        $this->_record->r->question = $this->_record->d->findManyToManyRowset('Questions','LnkSurveysQuestions');     
    }
}
